<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // js里没有类，但是构造函数充当了抽象也就是类的概念
        //this指代的是调用函数的对象
        function Animal (name, age) {
            this.name = name
            this.age = age
            this.say = function () {
                console.log(`My name is ${this.name}, I am ${this.age} year old`)
            }
        }

        var cat = new Animal ('Tom', 18)
        cat.say()
    </script>
</body>
</html>